import os

def check_label_format(folder_path):
    for filename in os.listdir(folder_path):
        if filename.endswith('.txt'):
            with open(os.path.join(folder_path, filename), 'r') as file:
                lines = file.readlines()
                for row, line in enumerate(lines, start=1):
                    fields = line.strip().split()
                    for col, field in enumerate(fields, start=1):
                        try:
                            float(field)  # 尝试将字段转换为浮点型
                        except ValueError:
                            print(f"在文件 {filename} 的第 {row} 行、第 {col} 列发现非浮点型数据: {field}")

# 从文件夹中读取 YOLO 格式的数据集
folder_path = '/home/hw/dataset/cone_total/test/labels'  # 替换成你的数据集文件夹路径
check_label_format(folder_path)